<!DOCTYPE html>
<html>
<head>
<title>普通商品管理</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="stylesheet" href="../../css/flowdesigner.css">
<link rel="stylesheet" href="../../css/bootstrap.min.css">
<link rel="stylesheet" href="../../css/font-awesome.min.css">
<link rel="stylesheet" href="../../plugins/jqgrid/ui.jqgrid-bootstrap.css">
<link rel="stylesheet" href="../../plugins/ztree/css/metroStyle/metroStyle.css">
<link rel="stylesheet" href="../../css/main.css">
<link rel="stylesheet" href="../../plugins/multiple-select/multiple-select.css">
<style type="text/css">
.myformError .myformErrorContent {
	width: 100%;
	background: #ee0101;
	position:relative;
	color: #fff;
	min-width: 120px;
	font-size: 11px;
	border: 2px solid #ddd;
	box-shadow: 0 0 6px #000;
	-moz-box-shadow: 0 0 6px #000;
	-webkit-box-shadow: 0 0 6px #000;
	-o-box-shadow: 0 0 6px #000;
	padding: 4px 10px 4px 10px;
	border-radius: 6px;
	-moz-border-radius: 6px;
	-webkit-border-radius: 6px;
	-o-border-radius: 6px;
}
</style>
<!-- myumeditor css start-->
<link href="../../plugins/myumeditor/themes/default/css/umeditor.css" type="text/css" rel="stylesheet">
<!-- myumeditor css end-->
<script src="../../libs/jquery.min.js"></script>
<!-- myumeditor js start-->
<script type="text/javascript" src="../../plugins/myumeditor/third-party/template.min.js"></script>
<script type="text/javascript" charset="utf-8" src="../../plugins/myumeditor/umeditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="../../plugins/myumeditor/umeditor.min.js"></script>
<script type="text/javascript" src="../../plugins/myumeditor/lang/zh-cn/zh-cn.js"></script>
<!-- myumeditor js end--> 
<script src="../../plugins/layer/layer.js"></script>
<script src="../../libs/bootstrap.min.js"></script>
<script src="../../libs/vue.min.js"></script>
<script src="../../plugins/jqgrid/grid.locale-cn.js"></script>
<script src="../../plugins/jqgrid/jquery.jqGrid.min.js"></script>
<script src="../../plugins/ztree/jquery.ztree.all.min.js"></script>
<script src="../../libs/ajaxupload.js"></script>
<script src="../../plugins/multiple-select/multiple-select.js"></script>
<link rel="stylesheet" href="../../plugins/validationEngine/validationEngine.jquery.css">
<script src="../../plugins/validationEngine/jquery.validationEngine-zh_CN.js"></script>
<script src="../../plugins/validationEngine/jquery.validationEngine-custom.js"></script>
<script src="../../plugins/validationEngine/jquery.validationEngine.js"></script>
<script src="../../js/common.js"></script>
<style type="text/css">
.overdiv{position:fixed; z-index:9997;top:0;left:0;width:100%; height:100%;background-color:white;filter: alpha(opacity=50); opacity: 0.5;text-align: center;color: white;}
.overdiv1{top:50%;margin-left:-32px;margin-top:-32px;left:50%;position:fixed; z-index:9999;overflow:auto;}
</style>
</head>
<body>
    <div id="down_div" class="overdiv xhide"></div><!-- 遮罩层 -->
    <div id="over_div" class="overdiv1 xhide"><img src="../../images/syspic/wait.gif" alt="txby" /></div><!-- 加载中 -->
<div id="rrapp" v-cloak>
	<div v-show="showList">
		<div class="grid-btn">
			<div class="form-group col-sm-2">
				<input type="text" class="form-control" v-model="q.name" @keyup.enter="query" placeholder="商品名称">
			</div>
			<a class="btn btn-default" @click="query">查询</a>
			<a v-if="hasPermission('sp:goods:save')" class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
			<a v-if="hasPermission('sp:goods:update')" class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
			<a v-if="hasPermission('sp:goods:update')" class="btn btn-primary" @click="startSell"><i class="fa fa-pencil-square-o"></i>&nbsp;上架</a>
			<a v-if="hasPermission('sp:goods:update')" class="btn btn-primary" @click="stopSell"><i class="fa fa-pencil-square-o"></i>&nbsp;下架</a>
			<a v-if="hasPermission('sp:goods:delete')" class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
		</div>
	    <table id="jqGrid"></table>
	    <div id="jqGridPager"></div>
    </div>
    <div v-show="!showList" class="panel panel-default">
		<div class="panel-heading">{{title}}</div>
		<form class="form-horizontal" id="defaultForm">
<!-- 			<div class="form-group">
				<div class="col-sm-2 control-label">商品编码<span  style="color: red;font-size: 16px">*</span></div>
				<div class="col-sm-10">
					<input type="text" class="form-control validate[required,custom[onlyLetterNumber]]" v-model="goods.NO" name="NO"
						placeholder="商品编码" value=""/>
				</div>
			</div> -->
		
			<input type="hidden"  v-model="goods.stockId" name="stockId"/>
			<input type="hidden"  v-model="goods.goodsPicId" name="goodsPicId"/>
			<div class="form-group">
				<div class="col-sm-2 control-label">商品名称<span  style="color: red;font-size: 16px">*</span></div>
				<div class="col-sm-10">
					<input type="text" class="form-control validate[required,minSize[1],maxSize[255]]" v-model="goods.name" name="name"
						placeholder="商品名称" value="" />
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">图片<span  style="color: red;font-size: 16px">*</span></div>
				<div class="col-sm-10">
				<fieldset class="inline-prompts">
					<label>
				 		<input type="text" class="form-control validate[required]"  readonly v-model="goods.url" id="url" name="req-summary" id="req-summary" data-prompt-position="inline" data-prompt-target="prompt-req-summary" data-errormessage="* 图片不能为空请上传."/>
					</label>
					<a class="btn btn-primary" id="upload"><i class="fa fa-plus"></i>&nbsp;上传图片</a>
					<p id="prompt-req-summary" class="prompt-target"></p>
				</fieldset>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">商品关键字</div>
				<div class="col-sm-10">
					<input type="text" class="form-control" v-model="goods.keyName" name="keyName"
						placeholder="商品关键字" value="" />
				</div>
			</div>		
			<div class="form-group">
				<div class="col-sm-2 control-label">商品价格<span  style="color: red;font-size: 16px">*</span></div>
				<div class="col-sm-10">
					<input type="text" class="form-control validate[required,custom[price]]" v-model="goods.price" name="price"
						placeholder="商品价格" value="" />
				</div>
			</div>		
			<div class="form-group">
				<div class="col-sm-2 control-label">单位<span  style="color: red;font-size: 16px">*</span></div>
				<div class="col-sm-10">
					<input type="text" class="form-control validate[required]" v-model="goods.unit" name="unit"
						placeholder="单位" value="" />
				</div>
			</div>		
			<div class="form-group">
				<div class="col-sm-2 control-label">库存量<span  style="color: red;font-size: 16px">*</span></div>
				<div class="col-sm-10">
					<input type="text" class="form-control validate[required,custom[positive_integer]]" v-model="goods.stockNum" name="stockNum"
						placeholder="库存量" value="" />
				</div>
			</div>		
			<div class="form-group">
				<div class="col-sm-2 control-label">商家<span  style="color: red;font-size: 16px">*</span></div>
				<div class="col-sm-10 layui-input-block">
					<select v-model="goods.shopsId" style="width:100%;" class="form-control validate[required]" id="shopsId">
						<option value="" selected = "selected">请选择</option>
						<option v-for="option in shopsList" v-bind:value="option.value">
								{{ option.text}}</option>
					</select>
				</div>
			</div>	
			<div class="form-group">
			   	<div class="col-sm-2 control-label">商品简介<span  style="color: red;font-size: 16px">*</span></div>
			   	<div class="col-sm-10">
			   	<!-- 
			   	 <input type="text" class="form-control" v-model="goods.introState" id="introState" style="display:none;"/>
			      <script type="text/plain" id="ueIntroState" style="width:1000px;height:240px;">
				  </script> -->
				   <textarea placeholder="请输入内容" class="layui-textarea form-control validate[required,minSize[1],maxSize[255]]" v-model="goods.introState" id="introState" ></textarea>
			    </div>
			</div>
			
			<div class="form-group">
				<div class="col-sm-2 control-label">商品详情<span  style="color: red;font-size: 16px">*</span></div>
				<div class="col-sm-10">
					<input type="text" class="form-control" v-model="goods.introDetail" name="introDetail" style="display:none"/>
					<script type="text/plain" id="ueIntroDetail" style="width:1000px;height:240px;">
				  	</script>
				  	<div id="ue0" class="prompt-target0" style="display:none">
					<div class="myformError inline"
						style="opacity: 0.87; position: relative; top: 0px; left: 0px; margin-top: 0px;">
						<div class="myformErrorContent">
							* 商品详情不能为空.<br>
						</div>
					</div>
					</div>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label">购买须知<span  style="color: red;font-size: 16px">*</span></div>
				<div class="col-sm-10">
					<input type="text" class="form-control validate[required]" v-model="goods.introNotice" name="introNotice" style="display:none"/>
					<script type="text/plain" id="ueIntroNotice" style="width:1000px;height:240px;">
				  	</script>
					<div id="ue1" class="prompt-target1" style="display:none">
					<div class="myformError inline"
						style="opacity: 0.87; position: relative; top: 0px; left: 0px; margin-top: 0px;">
						<div class="myformErrorContent">
							* 购买须知不能为空.<br>
						</div>
					</div>
					</div>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-2 control-label"></div> 
				<input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
				&nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
			</div>
		</form>
	</div>
</div>
<script src="../../js/modules/goods/baseGoods.js"></script>
<script language="javascript" type="text/javascript" src="../../js/modules/WdatePicker.js"></script>
<script type="text/javascript">
/* var umState = UM.getEditor('ueIntroState', {
	toolbar:[
        'undo redo | bold italic underline strikethrough | superscript subscript | forecolor backcolor | removeformat |',
        'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontfamily fontsize' ,
        '| justifyleft justifycenter justifyright justifyjustify | link unlink | image ',
        '| horizontal preview'
    ],
   	allHtmlEnabled: false,//提交到后台的数据是否包含整个html字符串
  	autoHeightEnabled: false,
    autoFloatEnabled: true,
    allowDivTransToP: false//阻止div标签自动转换为p标签
});
umState.addListener('blur',function(){
	vm.goods.introState=this.getContent();
});  */
var isEmpty=true;
var umDetail = UM.getEditor('ueIntroDetail', {
	toolbar:[
        'bold italic underline strikethrough | superscript subscript | forecolor backcolor | removeformat |',
        'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontfamily fontsize' ,
        '| justifyleft justifycenter justifyright justifyjustify | image '
    ],
   	allHtmlEnabled: false,//提交到后台的数据是否包含整个html字符串
  	autoHeightEnabled: false,
    autoFloatEnabled: true,
    allowDivTransToP: false//阻止div标签自动转换为p标签
});
umDetail.addListener('blur',function(){
	var cont = this.getPlainTxt();
	cont = $.trim(cont);
	if(cont) {
		isEmpty=false;
		$("#ue0").hide();
		vm.goods.introDetail=cont;
	} else {
		isEmpty=true;
		$("#ue0").show();
		return;
	}
}); 

var ueNotice = UM.getEditor('ueIntroNotice', {
	toolbar:[
        'bold italic underline strikethrough | superscript subscript | forecolor backcolor | removeformat |',
        'insertorderedlist insertunorderedlist | selectall cleardoc paragraph | fontfamily fontsize' ,
        '| justifyleft justifycenter justifyright justifyjustify | image '
    ],
   	allHtmlEnabled: false,//提交到后台的数据是否包含整个html字符串
  	autoHeightEnabled: false,
    autoFloatEnabled: true,
    allowDivTransToP: false//阻止div标签自动转换为p标签
});
ueNotice.addListener('blur',function(){
	var cont = this.getPlainTxt();
	cont = $.trim(cont);
	if(cont) {
		isEmpty=false;
		$("#ue1").hide();
		vm.goods.introNotice=cont;
	} else {
		isEmpty=true;
		$("#ue1").show();
		return;
	}
}); 
</script>
</body>
</html>